package com.door.erp.model;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.OrderBy;
import javax.persistence.Table;

import com.door.erp.enums.BaseInfoStatus;

/**
 * 采购单
 * @author yangxuelin
 */
@Entity
@Table(name = "purchaseorder", catalog = "door")
public class PurchaseOrder implements Serializable {

	private static final long serialVersionUID = 2728745442670542777L;

	private long id;
	
	private Supplier supplier;
	
	private Material material;
	
	private float thickness;
	
	private int amount;
	
	private String unit;
	
	private double unitPrice;
	
	private double totalPrice;
	
	private Date createTime;
	
	private String remark;
	
	private BaseInfoStatus status;

	@Id
	@GeneratedValue
	@Column(name = "id", unique = true, nullable = false)
	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	@OneToOne()
	@JoinColumn(name="supplierId")
	public Supplier getSupplier() {
		return supplier;
	}

	public void setSupplier(Supplier supplier) {
		this.supplier = supplier;
	}

	@OneToOne()
	@JoinColumn(name="materialId", nullable=false)
	public Material getMaterial() {
		return material;
	}

	public void setMaterial(Material material) {
		this.material= material;
	}

	@Column(name="thickness")
	public float getThickness() {
		return thickness;
	}

	public void setThickness(float thickness) {
		this.thickness = thickness;
	}

	@Column(name="amount", nullable=false)
	public int getAmount() {
		return amount;
	}

	public void setAmount(int amount) {
		this.amount = amount;
	}

	@Column(name="unit")
	public String getUnit() {
		return unit;
	}

	public void setUnit(String unit) {
		this.unit = unit;
	}

	@Column(name="unitPrice", nullable=false)
	public double getUnitPrice() {
		return unitPrice;
	}

	public void setUnitPrice(double unitPrice) {
		this.unitPrice = unitPrice;
	}

	@Column(name="totalPrice", nullable=false)
	public double getTotalPrice() {
		return totalPrice;
	}

	public void setTotalPrice(double totalPrice) {
		this.totalPrice = totalPrice;
	}

	@Column(name="createTime", nullable=false, updatable=false)
	@OrderBy(value="createTime desc")
	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	@Column(name="remark")
	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	@Column(name="status")
	public BaseInfoStatus getStatus() {
		return status;
	}

	public void setStatus(BaseInfoStatus status) {
		this.status = status;
	}

	
}
